package comman.duke 
{
	/**
	 * ...
	 * @author jerry.d
	 */
	public class TickerItem 
	{
		public var name:String;
		public var handler:Function;
		public var gap:int;//millseconds
		public var times:int;//how many times
		public var currentGap:int;
		public function TickerItem(name:String, handler:Function, gap:uint, times:int=-1) 
		{
			this.name = name;
			this.handler = handler;
			this.gap = gap;
			this.times = times;
		}
		
		public function advanceTime(delta:int):void{
			this.currentGap += delta;
			if ( this.currentGap >= this.gap ){
				handler(delta);
				if (this.times != -1){
					this.times--;
					if (this.times == 0){
						TickerMgr.Instance.remove(name);
					}
				}
				this.currentGap = 0;
			}
		}
	}

}